package cn.fl.mcr.transform;

import java.util.ArrayList;
import java.util.List;

import cn.cmm.base.framework.utils.CollectionUtils;
import cn.lionbridgecapital.loan.model.dto.McrWriteOffConfirmSummaryDTO;
import cn.lionbridgecapital.loan.model.vo.McrWriteOffConfirmSummaryVO;


/**
 * @Description: 核销确认汇总 转换器
 * @Description: VO是客户端传递数据到服务端进行转换的数据 
 * @Description: VO转换数据变成DTO传递到服务端 
 * @Description: VO不能在服务端出现
 */
public class McrWriteOffConfirmSummaryVOTransform {


	/**
	 * DTO 转  VO
	 * @param po McrWriteOffConfirmSummaryDTO
	 * @return McrWriteOffConfirmSummaryVO
	 */
	public static McrWriteOffConfirmSummaryVO toVO(McrWriteOffConfirmSummaryDTO dto) {
		McrWriteOffConfirmSummaryVO vo = null;
		if (dto != null) { 
			vo = new McrWriteOffConfirmSummaryVO();
			vo.setId(dto.getId());
			vo.setBatNo(dto.getBatNo());//批次号
			vo.setRepayNum(dto.getRepayNum());//还款笔数
			vo.setRepayAmt(dto.getRepayAmt());//实收总金额
			vo.setRepayPrincipal(dto.getRepayPrincipal());//实收总本金
			vo.setRepayInterest(dto.getRepayInterest());//实收总利息
			vo.setRepayPenaltyInterest(dto.getRepayPenaltyInterest());//实收总罚息
			vo.setCommitTm(dto.getCommitTm());//提交时间
			vo.setRepayDate(dto.getRepayDate());//打款日期
			vo.setConfirmBatNo(dto.getConfirmBatNo());//确认提交批次号
			vo.setCommitType(dto.getCommitType());//状态 -1:提交失败,0:待确认提交,1:提交成功

			vo.setCrtTm(dto.getCrtTm());//创建时间
			vo.setCrtUsrId(dto.getCrtUsrId());//创建人
			vo.setMdfTm(dto.getMdfTm());//修改时间
			vo.setMdfUsrId(dto.getMdfUsrId());//修改人
			vo.setFailReason(dto.getFailReason());
		}
		return vo;
	}

	/**
	 * VO 转 DTO
	 * @param dto McrWriteOffConfirmSummaryVO
	 * @return McrWriteOffConfirmSummaryDTO
	 */
	public static McrWriteOffConfirmSummaryDTO toDTO(McrWriteOffConfirmSummaryVO vo) {
		McrWriteOffConfirmSummaryDTO dto = null;
		if (vo != null) {
			dto = new McrWriteOffConfirmSummaryDTO();
			dto.setId(vo.getId());
			dto.setBatNo(vo.getBatNo());//批次号
			dto.setRepayNum(vo.getRepayNum());//还款笔数
			dto.setRepayAmt(vo.getRepayAmt());//实收总金额
			dto.setRepayPrincipal(vo.getRepayPrincipal());//实收总本金
			dto.setRepayInterest(vo.getRepayInterest());//实收总利息
			dto.setRepayPenaltyInterest(vo.getRepayPenaltyInterest());//实收总罚息
			dto.setCommitTm(vo.getCommitTm());//提交时间
			dto.setRepayDate(vo.getRepayDate());//打款日期
			dto.setConfirmBatNo(vo.getConfirmBatNo());//确认提交批次号
			dto.setCommitType(vo.getCommitType());//状态 -1:提交失败,0:待确认提交,1:提交成功

			dto.setCrtTm(vo.getCrtTm());//创建时间
			dto.setCrtUsrId(vo.getCrtUsrId());//创建人
			dto.setMdfTm(vo.getMdfTm());//修改时间
			dto.setMdfUsrId(vo.getMdfUsrId());//修改人
			dto.setFailReason(vo.getFailReason());
		}
		return dto;
	}
	
	/**
	 * DTO集合 转 VO集合
	 * @param List<McrWriteOffConfirmSummaryDTO>
	 * @return List<McrWriteOffConfirmSummaryVO>
	 */
	public static List<McrWriteOffConfirmSummaryVO> toVOList(List<McrWriteOffConfirmSummaryDTO> list) {
		List<McrWriteOffConfirmSummaryVO>  voList = new ArrayList<McrWriteOffConfirmSummaryVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (McrWriteOffConfirmSummaryDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}
	
	/**
	 * VO集合 转 DTO集合
	 * @param list List<McrWriteOffConfirmSummaryVO>
	 * @return List<McrWriteOffConfirmSummaryDTO>
	 */
	public static List<McrWriteOffConfirmSummaryDTO> toDTOList(List<McrWriteOffConfirmSummaryVO> list) {
		List<McrWriteOffConfirmSummaryDTO>  dtoList = new ArrayList<McrWriteOffConfirmSummaryDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (McrWriteOffConfirmSummaryVO vo : list) {
				dtoList.add(toDTO(vo));
			}
		}
		return dtoList;
	}
}
